import React, {Component} from 'react';
import { View } from 'react-native';

import { Selection, Button } from 'iftide';

export default class Basic2 extends Component {
    constructor(props) {
        super(props);
        this.state = {
            description:'选择项说明文字',
            error:false,
            value:'默认选择项'
        }
    }

    _onPress(){
        console.log('11');
    }

    _clickFunc(){
        this.setState({
            description:'错误提示',
            error:true,
            value:'错误选项'
        })
    }

    render() {
        return (
            <View>
                <Selection
                    title = '标题文字'
                    placeHolder = ''
                    isMerge = {true}
                    hasTopBorder = {true}
                    onPress = {()=>this._onPress()}
                />

                <Selection
                    title = '标题文字'
                    placeHolder = '选择项说明'
                    isMerge={true}
                    onPress = {()=>this._onPress()}
                />

                <Selection
                    title = '标题文字'
                    value = '错误选择项'
                    isRequired={true}
                    isMerge = {true}
                    onPress = {()=>this._onPress()}
                />

                <Selection
                    title = '标题文字'
                    value = {this.state.value}
                    isRequired={true}
                    captions = '标题说明文字'
                    isMerge = {true}
                    onPress = {()=>this._onPress()}
                />

                <Selection
                    title = '标题文字'
                    value = '错误选择项'
                    description = {this.state.description}
                    isMerge ={ true}
                    onPress = {()=>this._onPress()}
                    showErrorInfo = {this.state.error}
                />

                <Selection
                    title = '标题文字'
                    value = '默认选择项'
                    captions = '标题说明文字'
                    description = '选择项说明文字'
                    onPress = {()=>this._onPress()}
                />
                <View style={{marginVertical: 10, justifyContent: 'center', alignItems: 'center'}}>
                    <Button title={'点击'} onPress={()=>this._clickFunc()}/>
                </View>
            </View>
        );
    }
}